<template>
	<view>
		<view class="message_list" v-if="list.length>0">
			<view v-for="(item,index) in list" :key="index" @click="funHref('/pages/message/message_detail?id='+item.mess_id)">
				<b>{{item.mess_title}}</b>
				<p>{{item.mess_setTime.replace('T',' ')}}</p>
			</view>
		</view>
		<!--空信息-->
		<view class="nodata_con" v-if="isLoading==false&&list.length<=0">
			<label class="iconfont icon-meiyoushuju"></label>
			<text>{{$t('no_data')}}</text>
		</view>
		<!--刷新-->
		<view class='loadind_con' v-if="isLoading">
			<view class="loading">
				<view class="loading-bar"></view>
				<view class="loading-bar"></view>
				<view class="loading-bar"></view>
				<view class="loading-bar"></view>
			</view>
		</view>
	</view>
</template>
<script>
	import valid from '../../static/valid.js';

	export default {
		data() {
			return {
				index: 1, //页数
				size: 10, //条数
				list: [], //列表值
				isLoading: true, //是否正在加载
			}
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.$t('message')
			})
		},
		onLoad() {
			var _this = this;
			//加载列表
			_this.getData();
		},
		onPullDownRefresh() { //下拉刷新
			var _this = this;
			//清空还原
			_this.index = 1;
			_this.list = [];
			_this.isLoading = true;
			_this.getData();
		},
		onReachBottom() { //上拉到底部刷新
			var _this = this;
			_this.index = _this.index + 1;
			_this.isLoading = true;
			_this.getData();
		},
		methods: {
			getData: function() { //获取内容
				var _this = this;
				_this.fun_request("/Api/Message/GetPageList", {
					index: _this.index,
					size: _this.size,
					count: 0
				}, function(res) {
					console.log(res);
					var _list = res.data;
					_this.list = _this.list.concat(_list);
					//加载完成
					_this.isLoading = false;
					//下拉刷新 - 停止
					uni.stopPullDownRefresh();
				});
			},
			funHref: function(url) { //跳转
				this.fun_navigateTo(url);
			},
		}
	}
</script>
<style>
	page {
		background-color: #F7F7F7;
	}
</style>
